#pragma once
#include "stdafx.h"
#include <list>
#include <math.h>

struct SearchNode
{
	double h;
	double x;
	double v;
	double v_mid;
	double v2;
	double s;
	double v_fin;
	double u;

	SearchNode(double _h, double _x, double _v, double _v_mid, double _v2, double _s, double _v_fin, double _u):
	h(_h), x(_x), v(_v), v_mid(_v_mid), v2(_v2), s(_s), v_fin(_v_fin), u(_u) {}
};

class Solver
{
private: 
	double u0;
	double b;
	double epsilon_right;
	double epsilon;
	int Nmax;
	double h;

public: 
	Solver(double u0, double b, double eps, double eps_r, int n, double h);
	~Solver() { };

	std::list<SearchNode>* solve();
private:
	virtual double f(double x, double u);
	virtual double u(double x);

};